<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>物流信息查询</title>
    <link rel="stylesheet" href="/static/home/css/reset.css">
    <link rel="stylesheet" href="/static/home/css/main.css">
</head>
<body>
    <div class="container">
        <div class="form-box">
            <div class="form-box-input">
                <input type="text" id="phone" placeholder="请输入查询手机号码">
            </div>
            <div class="form-box-btn">
                <button type="button" id="submitBtn">查询</button>
            </div>
        </div>
        <div id="result-box"></div>
    </div>

    <script src="/js/jquery.min.js"></script>
    <script src="/static/home/layui/layui.js"></script>
    <script>
        layui.use(['layer'],function(){
            var layer = layui.layer;
            
            $("#submitBtn").click(function(){
                var phone = $("#phone").val();
                if(phone==''){
                    return layer.msg("请输入电话号码");
                }
                layer.load()
                $.post("<?php echo e(route('home.logistics.search')); ?>",{phone:phone,_token:"<?php echo e(csrf_token()); ?>"},function(res){
                    layer.closeAll();
                    if(res.code==0&&res.data.length>0){
                        var _html = ''
                        $.each(res.data,function(index,item){
                            _html +='<ul>';
                            _html +='   <li>快递日期：'+item.sent_at+'</li>';
                            _html +='   <li>姓名：'+item.accept_name+'</li>';
                            _html +='   <li>电话：'+item.accept_phone+'</li>';
                            _html +='   <li>快递公司：'+item.company_name+'</li>';
                            _html +='   <li>快递单号：<a href="https://m.kuaidi100.com/index_all.html?type=&postid='+item.order_num+'#result">'+item.order_num+'</a></li>';
                            _html +='   <li>快递产品介绍：'+item.goods_type+'</li>';
                            _html +='</ul>';
                        })
                        $("#result-box").html(_html)
                    }else{
                        layer.msg(res.msg);
                    }
                },'json');
            })


        })
    </script>
</body>
</html>